﻿namespace OpenPms.Controllers;
/// <summary>
/// 账务
/// </summary>
[Route("api/[controller]")]
public class AccountController : PmsControllerBase<AccountController>
{
    public AccountController(IServiceProvider serviceProvider) : base(serviceProvider)
    {
    }

    /// <summary>
    /// 查询账务 
    /// </summary>
    /// <param name="id">预订单号</param>
    /// <returns>主单账务列表</returns>
    [HttpGet("{id}")]
    public Task<List<TAccount>> QueryAccount(Guid id)
    {
        return OrderService.QueryAccountAsync(HotelId, id);
    }

    /// <summary>
    /// 新增账务
    /// </summary>
    /// <param name="q"></param>
    /// <returns>账务Id</returns>
    [HttpPost(nameof(Add))]
    public Task<Guid> Add(TAccount q)
    {
        q.HotelId = HotelId;
        return OrderService.AddAccountAsync(q);
    }


}
